package data;

import java.sql.ResultSet;
import java.sql.SQLException;

public class Methods {
	public int id=0;
	public int project_id=0;
	public String name="";
	public String location="";
	
	public Methods(int _id,int _project_id,String _name,String _location){
		id=_id;
		project_id=_project_id;
		name=_name;
		location=_location;
	}
	public static Methods[] fromResultSet(ResultSet rs){
		try {
			rs.last();
			int count=rs.getRow();
			int index=0;
			Methods[] methods=new Methods[count];
			rs.beforeFirst();
			while(rs.next()){
				methods[index]=new Methods(
						(Integer)rs.getObject(1),
						(Integer)rs.getObject(2),
						(String)rs.getObject(3),
						(String)rs.getObject(4));
				index++;
			}			
			return methods;
		}
		catch (SQLException e) {
			e.printStackTrace();
			return new Methods[0];
		}
		
	}
}
